package com.fl.ui;

import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.SwingConstants;

import org.apache.log4j.Logger;

import com.fl.util.ContentUtil;
import java.awt.BorderLayout;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;

public class DESUI extends SubUIModule {

	private static Logger log = Logger.getLogger(DESUI.class);
	private JLabel keyLabel;
	private JPasswordField keyField;

	@Override
	public String getName() {
		// 返回名称
		return ContentUtil.getString("DESUI.tooltip");
	}

	/**
	 * Create the dialog.
	 */
	public DESUI(WorkUI swingset) {

		super(swingset, "DESUI", "toolbar/JButton.gif");

		// 主panel
		JPanel subPanel = getSubUIPanel();
		subPanel.setLayout(new GridBagLayout());
		
		// 第一层panel，输入DES密钥
		JPanel keyPanel = new JPanel();
		keyPanel.setLayout(new BoxLayout(keyPanel, BoxLayout.X_AXIS));
		keyLabel = new JLabel(ContentUtil.getString("DESUI.keyLabel"));
		keyPanel.add(keyLabel);
		
		keyField = new JPasswordField();
		keyPanel.add(keyField);
		
		// 第二层panel，加解密文件选择
		
		// 第三层panel，存放路径选择
		
		// 第四层panel，两个按钮，加密，解密
		
		
		GridBagConstraints c1 = new GridBagConstraints();
		c1.gridx = 0;
		c1.gridy = 0;
		c1.weightx = 1.0;
		c1.weighty = 1.0;

		c1.fill = GridBagConstraints.HORIZONTAL;
		subPanel.add(keyPanel, c1);
		
		
		
		
		

		// try {
		//
		// setBounds(100, 100, 739, 387);
		// getContentPane().setLayout(new BorderLayout());
		// contentPanel.setLayout(new FlowLayout());
		// contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
		//
		// // 最底部状态栏
		//
		// boolean isTaskAlive = SchedulerService.isTaskAlive();
		// log.info("isTaskAlive:" + isTaskAlive);
		// JLabel statusLabel = new JLabel();
		// if (isTaskAlive) {
		// statusLabel.setText("定时任务正在运行");
		// statusLabel.setIcon(IconUtil.getGreenLightIcon());
		// } else {
		// statusLabel.setText("定时任务已经停止");
		// statusLabel.setIcon(IconUtil.getRedLightIcon());
		// }
		// statusLabel.setBounds(0, 407, 712, 15);
		// contentPanel.add(statusLabel);
		//
		// getContentPane().add(contentPanel, BorderLayout.CENTER);
		//
		// {
		// JPanel buttonPane = new JPanel();
		// buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
		// getContentPane().add(buttonPane, BorderLayout.SOUTH);
		// {
		// JButton okButton = new JButton("OK");
		// okButton.setActionCommand("OK");
		// buttonPane.add(okButton);
		// getRootPane().setDefaultButton(okButton);
		// }
		// {
		// JButton cancelButton = new JButton("Cancel");
		// cancelButton.setActionCommand("Cancel");
		// buttonPane.add(cancelButton);
		// }
		// }
		// } catch (SchedulerException e) {
		// e.printStackTrace();
		// }
	}

}
